import Axios from "../request";

let userList = [
    {
        userName: 'admin',
        realName: '张三',
        gender: 1,
        mobile: '13578894556',
        orgId: 1,
        orgName: '研发部',
        post: '前端开发工程师',
        roleIdList: [2, 1],
        roleNameList: ['开发人员', '管理员'],
        createTime: '2022-12-05 13:10:00',
        id: 1
    },
    {
        userName: 'lisi',
        realName: '李四',
        gender: 0,
        mobile: '13965874512',
        orgId: 2,
        orgName: '销售1部',
        post: '销冠',
        roleIdList: [3],
        roleNameList: ['销售人员'],
        createTime: '2022-12-05 13:10:00',
        id: 2
    },
]
for (let i = 0; i < 200; i++) {
    userList.push({
        userName: 'wangwu',
        realName: '王五',
        gender: 0,
        mobile: '13965874512',
        orgId: 3,
        orgName: '销售2部',
        post: '销冠',
        roleIdList: [3],
        roleNameList: ['销售人员'],
        createTime: '2022-12-05 13:10:00',
        id: i + 3
    })
}

const orgs = [
    { id: 1, name: '研发部' },
    { id: 2, name: '销售1部' },
    { id: 3, name: '销售2部' },
]

const roleIds = [
    { name: '管理员', id: 1 },
    { name: '开发人员', id: 2 },
    { name: '销售人员', id: 3 }
]

/**
 * 获取用户列表
 * @method getUser
 */
export const getUser = (params: any) => Axios.get(`list`, {
    params: params
});

/**
 * 新增用户
 * @method postUser
 */
export const postUser = (data: any) => Axios.post(`add`, data)

/**
 * 编辑用户
 * @method putUser
 */
export const putUser = (data: any) => Axios.put(`update`, data)

/**
 * 获取用户详细信息
 * @method getUserDetail
 */

export const getUserDetail = (params: any) => Axios.get(`detail`, {
    params: params
});

/**
 * 删除用户
 * @method deleteUser
 */

export const deleteUser = (params: any) => Axios.delete(`delete`, {
    params: params
});